package games.ninJumpDx.ui.actions
{
	import core.Global;
	
	import flash.utils.getTimer;
	
	import games.ninJumpDx.data.GameData;
	import games.ninJumpDx.data.UIConfig;
	import games.ninJumpDx.tools.Tools;
	
	import utils.Cartoon;
	
	public class Foreground extends Cartoon
	{
		public function Foreground(name:String)
		{
			super();
			addChild(Tools.getBitmapByName(name,GFrame.MAIN_UI));
		}
		
		override public function update(t:Object=null):void
		{
			if(!start || pause)return;
			if(y > UIConfig.getGameHeight() )
			{
				destroy();
				return ;
			}
		
			y += GameData.instance.speed;
		}
		
		override public function destroy(e:* = null):void
		{
			super.destroy();
			while(numChildren > 0)
				removeChildAt(0);
		}
	}
}